package com.sfac.springBoot.modules.test.dao;

import com.sfac.springBoot.modules.test.entity.Country;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Repository
@Mapper
public interface CountryDao {
    @Select("select * from test_country where country_id=#{countryId}")
    @Results(id = "resultMap",value = {
            @Result(property = "countryId" ,column = "country_id"),
            @Result(property = "cities",
                    column = "country_id",
                    javaType = List.class,
                    many = @Many(select = "com.sfac.springBoot.modules.test.dao.CityDao.queryById2"))
    })
    Country queryById(int countryId);

}
